# 注册小程序
print("可选项:ID、EMAIL地址、身份证号、姓名")
fun = ["ID","EMAIL地址","身份证号","姓名"]
choice = input("选择操作:")
info = input("请输入你的信息:")
length = len(info)
# 记录用户正确输入后的结果
result = '';
flag = True
print(length)
if fun[0] == choice:
    print("ID注册")
    if(length > 8 or length < 1):
        print("ID长度不能超过8")
    else:
        for i in range(length):
            if((ord(info[i]) >= ord('0') and ord(info[i]) <= ord('9')) or (ord(info[i]) >= ord('a') and ord(info[i]) <= ord('z')) 
    or (ord(info[i]) >= ord('A') and ord(info[i]) <= ord('Z')) or ord(info[i]) == ord('_')):
                continue
            else:
                flag = False
                break
        if flag == True:
            print('格式正确')
        if flag ==  False:
            print('格式错误，只能由数字、字母、下划线组成')
elif fun[1] == choice:
    print("输入邮箱")
    if '@' not in info or '.' not in info:
        flag = False
        print('邮箱格式不正')
    else:
        rindex = info.find("@")
        lindex = info.find(".")
        if rindex < lindex:
            Flag = False
            print('邮箱格式不正确')
elif fun[2] == choice:
    print("身份证注册操作:")
    if length != 18:
        Flag = False
        print('身份证格式错误')
    else:
        for i in range(length):
            if(ord(info[i]) >= ord('0') and ord(info[i]) <= ord('9'):
               continue
            else:
               flag = False
elif fun[3] == choice:
    print("姓名")
    if length > 4 or length < 0:
           print('名字长度不符合')
    else:
        for i in range(length): 
            if ch <  '一' or ch > '龥':
                flag = False
else:
    print("错误输入，请输入:ID、EMAIL地址、身份证号、姓名")

